package com.ccc.util.page;

import java.util.Map;

import com.ccc.model.User;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.MethodFilterInterceptor;

public class ManufacturerInterceptor extends MethodFilterInterceptor {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1177809939236871346L;

	@SuppressWarnings("unchecked")
	@Override
	protected String doIntercept(ActionInvocation invocation) throws Exception {
		String result=null;
		Map session=invocation.getInvocationContext().getSession();
		User user=(User)session.get("user");
		if(user!=null&&user.getRole().getRoleId()==1){
			result=invocation.invoke();
		}
		result=Action.LOGIN;
		return result;
	}

}
